﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/AdminMaster.master"
    Inherits="System.Web.Mvc.ViewPage<Eacademy.Domain.Models.AdminMentorsViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    AddMentor
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Add Mentor</h2>
    <% using (Html.BeginForm("Add", "Mentors", FormMethod.Post, new { autocomplete = "off" }))
       {%>
    <div class="forms-elements">
        <div class="form-wrapper">
            <div class="form-label">
                Image
            </div>
            <div class="form-element">
                <div class="preview">
                    <table style="margin: 0pt auto;" cellpadding="0" cellspacing="0">
                        <tbody>
                            <tr>
                                <td style="height: 100px;">
                                    <img src="<%= Model.ThumbImageName %>" id="thumb" />
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="wrap">
                    <label>
                        Upload a picture for student</label>
                    <input id="file-upload" name="file_upload" type="file" />
                    <input id="file-name" type="hidden" name="filename" value="<%= Model.ImageName %>" />
                </div>
            </div>
            <div class="form-error form-error-100">
            </div>
        </div>
        <div class="form-wrapper">
            <div class="form-label">
                <%: Html.LabelFor(model => model.FirstName)%>
            </div>
            <div class="form-element">
                <div class="textbox-xmedium-form">
                    <%: Html.TextBoxFor(model => model.FirstName, new { @class = "textbox-xmedium-field" })%>
                </div>
            </div>
            <div class="form-error form-error-150">
                <%: Html.ValidationMessageFor(model => model.FirstName)%>
            </div>
        </div>
        <div class="form-wrapper">
            <div class="form-label">
                <%: Html.LabelFor(model => model.MiddleName)%>
            </div>
            <div class="form-element">
                <div class="textbox-xmedium-form">
                    <%: Html.TextBoxFor(model => model.MiddleName, new { @class = "textbox-xmedium-field" })%>
                </div>
            </div>
            <div class="form-error form-error-150">
                <%: Html.ValidationMessageFor(model => model.MiddleName)%>
            </div>
        </div>
        <div class="form-wrapper">
            <div class="form-label">
                <%: Html.LabelFor(model => model.LastName)%>
            </div>
            <div class="form-element">
                <div class="textbox-xmedium-form">
                    <%: Html.TextBoxFor(model => model.LastName, new { @class = "textbox-xmedium-field" })%>
                </div>
            </div>
            <div class="form-error form-error-150">
                <%: Html.ValidationMessageFor(model => model.LastName)%>
            </div>
        </div>
        <div class="form-wrapper">
            <div class="form-label">
                <%: Html.LabelFor(model => model.PrimaryEmail)%>
            </div>
            <div class="form-element">
                <div class="textbox-xmedium-form">
                    <%: Html.TextBoxFor(model => model.PrimaryEmail, new { @class = "textbox-xmedium-field" })%>
                </div>
            </div>
            <div class="form-error form-error-150">
                <%: Html.ValidationMessageFor(model => model.PrimaryEmail)%>
            </div>
        </div>
        <div class="form-wrapper">
            <div class="form-label">
                <%: Html.LabelFor(model => model.SecondaryEmail)%>
            </div>
            <div class="form-element">
                <div class="textbox-xmedium-form">
                    <%: Html.TextBoxFor(model => model.SecondaryEmail, new { @class = "textbox-xmedium-field" })%>
                </div>
            </div>
            <div class="form-error form-error-150">
                <%: Html.ValidationMessageFor(model => model.SecondaryEmail)%>
            </div>
        </div>
        <br />
        <div class="form-wrapper">
            <div class="form-label">
                <%: Html.LabelFor(model => model.Username)%>
            </div>
            <div class="form-element">
                <div class="textbox-form">
                    <%: Html.TextBoxFor(model => model.Username, new { @class = "textbox-field" })%>
                </div>
            </div>
            <div class="form-error form-error-150">
                <%: Html.ValidationMessageFor(model => model.Username)%>
            </div>
        </div>
        <div class="form-wrapper">
            <div class="form-label">
                <%: Html.LabelFor(model => model.Password)%>
            </div>
            <div class="form-element">
                <div class="textbox-form">
                    <%: Html.PasswordFor(model => model.Password, new { @class = "textbox-field" })%>
                </div>
            </div>
            <div class="form-error form-error-150">
                <%: Html.ValidationMessageFor(model => model.Password)%>
            </div>
        </div>
        <div class="form-wrapper">
            <div class="form-label">
                <%: Html.LabelFor(model => model.ConfirmPassword)%>
            </div>
            <div class="form-element">
                <div class="textbox-form">
                    <%: Html.PasswordFor(model => model.ConfirmPassword, new { @class = "textbox-field" })%>
                </div>
            </div>
            <div class="form-error form-error-150">
                <%: Html.ValidationMessageFor(model => model.ConfirmPassword)%>
            </div>
        </div>
        <div class="form-wrapper">
            <div class="form-label">
                <%: Html.LabelFor(model => model.EmployeeNumber)%>
            </div>
            <div class="form-element">
                <div class="textbox-form">
                    <%: Html.TextBoxFor(model => model.EmployeeNumber, new { @class = "textbox-field" })%>
                </div>
            </div>
            <div class="form-error form-error-150">
                <%: Html.ValidationMessageFor(model => model.EmployeeNumber)%>
            </div>
        </div>
        <div class="form-wrapper">
            <div class="form-label">
            </div>
            <div class="form-element">
                <input type="submit" value="Add Mentor" class="button-style" />
                <input type="button" value="Cancel" onclick="window.open('/admin/mentor','_self');"
                    class="button-style" />
            </div>
        </div>
    </div>
    <% } %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
    <script type="text/javascript" src="/content/js/swfobject.js"></script>
    <script type="text/javascript" src="/content/js/jquery.uploadify.v2.1.4.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var auth = "<% = Request.Cookies[FormsAuthentication.FormsCookieName]==null ? string.Empty : Request.Cookies[FormsAuthentication.FormsCookieName].Value %>";
            var ss = "<%= Session.SessionID %>;"
            $('#file-upload').uploadify({
                uploader: "/content/uploadify.swf",
                script: "/admin/mentors/uploadimage/",
                cancelImg: "/content/images/cancel.png",
                buttonText: "Change Picture",
                auto: true,
                queueID: 'uploadifyQueue',
                queueSizeLimit: 100,
                simUploadLimit: 1,
                removeCompleted: false,
                scriptData: { authtoken: auth, si: ss },
                fileDesc: 'Image (*.jpg;*.jpeg;*.gif;*.png)',
                fileExt: '*.jpg;*.jpeg;*.png;*.gif',
                multi: false,
                onSelect: function (event, ID, fileObj) {
                    $('.preview > table').hide();
                    $('.preview').addClass('loading');
                },
                onComplete: function (event, ID, fileObj, response, data) {
                    var thumb = $('#thumb');
                    var dataResponse = $.parseJSON(response);
                    $('.preview > table').show();
                    $('.preview').removeClass('loading');
                    thumb.attr('src', dataResponse.url);
                    $("#file-name").val(dataResponse.filename);
                },
                onError: function (a, b, c, d) {
                    if (d.status == 404)
                        alert("Could not find upload script. Use a path relative to: ");
                    else if (d.type === "HTTP")
                        alert("error " + d.type + ": " + d.status);
                    else if (d.type === "File Size")
                        alert(c.name + " " + d.type + " Limit: " + Math.round(d.sizeLimit / 1024) + "KB");
                    else
                        alert("error " + d.type + ": " + d.text);
                }
            });

        });
    </script>
</asp:Content>
